/*
Ext.namespace('GBIF.GeoSpatial');

GBIF.GeoSpatial.wfsFeature = function(config){
	 
	 var wfslayer = new OpenLayers.Layer.Vector("WFS", {
    styleMap: styles,
    strategies: [new OpenLayers.Strategy.BBOX()],
    protocol: new OpenLayers.Protocol.WFS({
              url:  "http://localhost:8080/geoserver/wfs",
              featureType: "school_pt",
              featureNS: "http://postgis.org",
              srsName: "EPSG:900913",
              version: "1.1.0"                    
              })
});
	 		
	        var map, layer, select, hover, control;
			
			OpenLayers.ProxyHost= "http://www.silverbiology.com/clients/gbif/geospatial/resources/api/getfeatureinfo-proxy.php?url=";
			
			map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.PanZoom(),
                    new OpenLayers.Control.Permalink(),
                    new OpenLayers.Control.Navigation()
                ]
            });
            layer = new OpenLayers.Layer.WMS(
                "States WMS/WFS",
                "http://demo.opengeo.org/geoserver/ows",
                {layers: 'topp:states', format: 'image/gif'}
            );
            select = new OpenLayers.Layer.Vector("Selection", {styleMap: 
                new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
            });
            hover = new OpenLayers.Layer.Vector("Hover");
           
		    map.addLayers([layer, hover, select]);
            
            control = new OpenLayers.Control.GetFeature({
                protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer),
                box: true,
                hover: true,
                multipleKey: "shiftKey",
                toggleKey: "ctrlKey"
            },OpenLayers.ProxyHost= "http://www.silverbiology.com/clients/gbif/geospatial/resources/api/getfeatureinfo-proxy.php?url="
			);
            control.events.register("featureselected", this, function(e) {
                select.addFeatures([e.feature]);
            });
            control.events.register("featureunselected", this, function(e) {
                select.removeFeatures([e.feature]);
            });
            control.events.register("hoverfeature", this, function(e) {
                hover.addFeatures([e.feature]);
            });
            control.events.register("outfeature", this, function(e) {
                hover.removeFeatures([e.feature]);
            });
            map.addControl(control);
            control.activate();

         //   map.setCenter(new OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078).getCenterLonLat(), 3);
	Ext.apply(this,config,{
			title: "Map"
        ,	height: 400
        ,	width: 600
		,	map:map
        ,	center: new OpenLayers.LonLat(-90, 45)
        ,	zoom: 3
	});
	
	GBIF.GeoSpatial.wfsFeature.superclass.constructor.call(this, config)
}
Ext.extend(GBIF.GeoSpatial.wfsFeature, GeoExt.MapPanel, {
	GBIF.GeoSpatial.WFSFeature
})*/


Ext.namespace('GBIF.GeoSpatial');

GBIF.GeoSpatial.WFSFeature = function(config){
    
            map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.PanZoom(),
                    new OpenLayers.Control.Permalink(),
                    new OpenLayers.Control.Navigation()
                ]
            });
            layer = new OpenLayers.Layer.WMS(
                "States WMS/WFS",
                "http://demo.opengeo.org/geoserver/ows",
                {layers: 'topp:states', format: 'image/gif'}
            );
            select = new OpenLayers.Layer.Vector("Selection", {styleMap: 
                new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
            });
            hover = new OpenLayers.Layer.Vector("Hover");
            map.addLayers([layer, hover, select]);
		   
		   var params = {
				service: 'WFS',
				version: '1.1.0',
				request: 'GetFeature',
				typename: 'topp:statess',
				maxfeatures: 2,
			}
			map.events.register('click', params, function (e) {
	           OpenLayers.loadURL("../../resources/api/getfeatureinfo-proxy.php?url=http://ogc.gbif.org/ows", this, params, setHTML, setHTML);
               OpenLayers.Event.stop(e);
                });
			
	setHTML=function(response){
	
		console.log('Response',response);
	
	 };  
		
    map.setCenter(new OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078).getCenterLonLat(), 3);


 	Ext.apply(this,config,{
			title: "Map"
        ,	height: 400
        ,	width: 500
		,	map:map
		,	zoom:4
	})
	
	
	
	
	GBIF.GeoSpatial.WFSFeature.superclass.constructor.call(this, config)
}
Ext.extend(GBIF.GeoSpatial.WFSFeature, GeoExt.MapPanel, {
	
})
